/* 
 * File:   Topologies.h
 * Author: jcrada
 *
 * Created on April 8, 2009, 8:30 PM
 */

#ifndef _TOPOLOGIES_H
#define	_TOPOLOGIES_H
#include "PsoOperators.h"

#include "PsoModel.h"
namespace jcrada {

    class RingSharingMethod : public PsoSharingMethod {
    private:
        int _neighbors;
    public:
        RingSharingMethod( int neighbors = 2 );

        virtual void share( PsoModel& model );

        virtual void setNeighbors( int neighbors ) {
            this->_neighbors = neighbors;
        }

        virtual int getNeighbors( ) const {
            return this->_neighbors;
        }
    };

    class StarSharingMethod : public PsoSharingMethod {
    public:
        virtual void share( PsoModel& model );
    };

    class VonNeumannSharingMethod : public PsoSharingMethod {
    protected:

        virtual bool isValidIndex( int size, int index );
        virtual void findBestVonNeumannNeighbors( PsoModel& model, int cubes, PsoParticle **** vneumann,
                PsoParticle ** allnbest );

    public:
        virtual void share( PsoModel& model );
    };
}

#endif	/* _TOPOLOGIES_H */

